<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <p slot='header'>头部信息</p>
        <alert-slot>我是数字</alert-slot>


    </div>
</body>
<script src="../vue.js"></script>
<script>
    Vue.component('alert-slot', {
        data: function() {
            return {
                msg: '123'
            }
        },
        // 具名插槽
        template: `<div>
        <header >

        <slot name='header'></slot>
        </header>
           <span>{{msg}}<span>
            <strong>Error:</strong>
            <slot></slot>
        </div>`
    })
    var vm = new Vue({
        el: '#app',
        data: {},
        methods: {

        },
    })
</script>

</html>